package com.WindowFunction;

import javax.swing.*;
import java.awt.*;

public class CreateWindowAction {
    /**
     * 创建窗口
     * @return
     */
    public JFrame CreateWindow(boolean Undecorated,boolean AlwaysOnTop,int width,int height,
                               Color color,int DefaultCloseOperation, boolean Visible){
        JFrame frame = new JFrame();
        frame.setUndecorated(Undecorated);                                 //设置标题栏不可见
        frame.setAlwaysOnTop(AlwaysOnTop);       //总是在最前面
        frame.setSize(width,height);                         //窗口大小
        frame.setBackground(color);    //设置背景透明
        frame.setLocationRelativeTo(null);                  //屏幕居中
        frame.setDefaultCloseOperation(DefaultCloseOperation);   //设置关闭窗口后关闭程序
        frame.setVisible(Visible);//窗口可见
        return frame;
    }
}
